package net.bplaced.streetfighter.lib.async.task;

import net.bplaced.streetfighter.lib.model.Team;
import net.bplaced.streetfighter.lib.service.TeamServiceImpl;
import net.bplaced.streetfighter.lib.utils.CallBack;
import net.bplaced.streetfighter.lib.utils.ServiceReturnPackage;
import android.content.Context;

/**
 * @author Sebastian Hoffmann <bo.hoffi@googlemail.com>
 */
public class TeamLoaderTask
        extends AbstractLoaderTask<String, ServiceReturnPackage<Team[]>> {

    public TeamLoaderTask(Context context, String progressMessage, CallBack<ServiceReturnPackage<Team[]>> onFinished) {

        super(context, progressMessage, onFinished);

    }

    @Override
    ServiceReturnPackage<Team[]> performInBackground(String... teams) {

        if (teams.length != 1) {
            return null;
        }

        return new TeamServiceImpl().loadTeamsViaPOST(teams[0]);
    }
}